home *** CD-ROM | disk | FTP | other *** search
/ BMUG Revelations / BMUG Revelations.toast / Programming / Programming Languages / Yerk 3.64 / Supplement / Unsupported / Utilities / Words < prev   
Text File  |  1986-01-24  |  7KB  |  197 lines

  1. \ words -- sorted and a unsorted WORDS that may be echoed to the printer
  2. \ 11/30/84  SSG Version 1.0
  3. \ 12/17/84  SSG Moved selectors to select1; modified sortnfas:
  4. \ 12/17/84  SSG Modified w;  deleted .h  and .d
  5. \ 12/19/84  SSG Commented-out method words:
  6. \ 12/29/84  SSG Added page: and lastPage: to WordsClass
  7. \ 12/31/84  SSG Made theList an ordered-col in theList (mod)
  8. \               Changed WordsClass methods to NEON words.
  9. \  2/17/85  SSG Made compatible with Neon release 0.95
  10. \  1/05/86  cdn Mode compatible with Neon release 1.5
  11.  
  12. 900 ordered-col theList
  13. 30 ordered-col fileMarkers     \ first NFA's of source files
  14.  
  15. : initFMarkers 
  16.       clear: fileMarkers
  17.             \ NFA's of first word in each source file
  18. ' theList      \ ---above---
  19. ' frontend     \ frontend
  20. ' basicstr     \ basicstr
  21. ' ?new         \ menu 
  22. ' pstartlen    \ proc
  23. ' myDoc        \ objInit
  24. ' thewindow    \ window
  25. ' srccopy      \ qd
  26. ' menubar      \ event
  27. ' aboutmod     \ imports
  28. ' odddp        \ mod
  29. ' 2**          \ ovl
  30. ' -echo        \ files
  31. ' nullcfa      \ struct
  32. ' dmp          \ object
  33. ' ^self        \ class
  34. ' inparms      \ args
  35. ' \            \ base
  36.         18 0 DO nfa add: fileMarkers LOOP   ;
  37.  
  38. \ ( idx -- )
  39. : .file select{  ( source file name )
  40.          0  is{ ." nucleus" }end 
  41.          1  is{ ." Base" }end 
  42.          2  is{ ." Args" }end 
  43.          3  is{ ." Class" }end 
  44.          4  is{ ." Object" }end 
  45.          5  is{ ." Struct" }end 
  46.          6  is{ ." Files" }end 
  47.          7  is{ ." Ovl" }end 
  48.          8  is{ ." Mod" }end 
  49.          9  is{ ." Imports" }end 
  50.         10  is{ ." Event" }end 
  51.         11  is{ ." QD" }end 
  52.         12  is{ ." Window" }end 
  53.         13  is{ ." objInit" }end 
  54.         14  is{ ." Proc" }end 
  55.         15  is{ ." Menu" }end 
  56.         16  is{ ." BasicStr" }end 
  57.         17  is{ ." FrontEnd" }end
  58.         18  is{ ." ---Above---" }end
  59.       }select ;
  60.  
  61. \ ( NFA -- previousNFA )
  62. : nextNfa    pfa lfa @ ;
  63.  
  64. \ Pads with blanks to field-width using current out and zeroes out.
  65. ( fldWid -- )
  66. : padBlanks  out - spaces    0 -> out ;
  67.  
  68. \ Prints name of source file which contains the word.
  69. : .word { theNfa \ index before after -- } 0 -> after
  70.         5 spaces
  71.         size: fileMarkers dup  -> index  0   \   size  0 --
  72.         DO  theNfa i at: fileMarkers <
  73.             IF   i -> index  leave THEN
  74.         LOOP
  75.         theNfa 6 .r  space
  76.         0 -> out      \ Initialize system output count value.
  77.         theNfa id.  $ 10 padBlanks  \ 16 chars for name 
  78.         index .file
  79.       $ 14 padBlanks       \ 20 chars for file name
  80.       context @ -> after               \ last dictionary entry
  81.       theNfa after =
  82.       IF ."  last entry"
  83.       ELSE  after nextNfa -> before    \ previous entry
  84.                 BEGIN theNfa before <  WHILE    
  85.                          before -> after
  86.                          after nextNfa -> before
  87.                 REPEAT
  88.                 theNfa nextNfa -> before
  89.                 before id. $ 10 padblanks
  90.                 after id.  $ 10 padblanks
  91.       THEN   
  92.       cr ;
  93.  
  94. \ Takes word from input stream and prints the name of the source file
  95. \         that contains it.
  96. : w         initFMarkers
  97.               @pfa nfa .word ;
  98.  
  99. ( 7-Sep-84 )
  100. : d20      ( -- )    ( Usage: d20 doit  ;  dumps the head of doit )
  101.           [compile] ' nfa $ 20 dump ;
  102.  
  103. : d80      ( -- )    ( Usage: d80 doit  ;  dumps  doit )
  104.           [compile] ' nfa $ 80 dump ;
  105.  
  106. ( -- )   \  Lists nfa's and name strings four-across as in WORDS.
  107. :  list  base >r hex     cr cr 
  108.          0 put out     
  109.          size: [ theList ]  0
  110.          DO   I at: [ theList ] dup 6 .r
  111.                 dup 1+ c@
  112.                 IF space id.    ELSE ."  Null" drop   THEN
  113.                 out $ 3b >
  114.                 IF        cr  0 put out
  115.                 ELSE    $ 14 out over mod - spaces
  116.                 THEN
  117.                 ?pause
  118.         LOOP
  119.         r> put base       ;
  120.  
  121. \ Prints page number and issues formfeed if 58 lines out.
  122. :  page      { len -- }
  123.              len 58 /mod swap not       \ 58 lines printed out?
  124.              IF     cr 
  125.                      38 spaces   ." Page"   .d cr 
  126.                      np              \ Send a form feed.
  127.               ELSE  drop                          \ number of pages
  128.               THEN      ;
  129.  
  130. \ Prints last page number and number of entries.
  131. :   lastPage  { len -- }
  132.         cr   cr  
  133.         5 spaces ." There are" size: [ theList ] .d  ." entries in the dictionary."
  134.         cr    3 ++> len
  135.         len 58 /mod 1+                      \ lines-on-last-page  page# --
  136.         58 rot -  0 DO cr  LOOP             \ Linefeed to end of page.
  137.         38 spaces  ." Page" .d  cr np       \ Print last page number. 
  138.               ;
  139.        
  140. \ Compares the name strings pointed to by two NFAs.
  141. (  nfa1  nfa2  -- result )
  142. : nfaComp   count $ 1F and rot 
  143.                   count $ 1F and 2swap       \ addr1 len1  addr2 len2 --
  144.                   $= ;
  145.  
  146. ( -- )    \ Puts all nfa's in dictionary into theList. 
  147. :  getNfas   clear: [ theList ]
  148.         last: fileMarkers pfa lfa @
  149.         BEGIN dup add: [ theList ] pfa lfa @ dup 0= UNTIL
  150.         drop     ;
  151.  
  152. ( -- )
  153. : sortNfas    ixaddr: [ theList ]  size: [ theList ]  'c nfacomp  sort   ;
  154.  
  155. \ Prints names of all word and the source files that contain them
  156. : sources   { \ len -- }
  157.          initFMarkers
  158.          cr ." Sorting... Please Wait."
  159.          getnfas  sortnfas
  160.          base >r hex
  161.          0 -> len   +print
  162.          size: [ theList ] 0
  163.          DO   i at: [ theList ] .word
  164.               1 ++> len len page
  165.               ?pause
  166.          LOOP
  167.          len lastPage
  168.          r> put base   -print       ;
  169.  
  170. \ like list; routes output to printer.
  171. :  print    { \ len -- }
  172.          base >r hex     cr  5 spaces
  173.          0 put out      0 -> len
  174.          size: [ theList ]  0
  175.          DO   I at: [ theList ] dup 6 .r
  176.                 dup 1+ c@
  177.                 IF space id.    ELSE ."  Null" drop   THEN
  178.                 out $ 3b >
  179.                 IF     cr    5 spaces   0 put out
  180.                         1 ++> len   len    page
  181.                          out IF 5 spaces 0 put out THEN
  182.                 ELSE $ 14 out over mod - spaces
  183.                 THEN
  184.                 ?pause
  185.         LOOP
  186.         len lastPage
  187.         r> put base       ;
  188.  
  189. \ :  words         getnfas  list  ;
  190.  
  191. :  aWords       cr ." Sorting... Please wait."   getnfas  sortnfas  list   ;
  192.  
  193. :  pWords      +print  getnfas   print     -print  ;
  194.  
  195. :  paWords   -print  cr ." Sorting... Please wait."
  196.                     +print   getnfas  sortnfas  print   -print  ;
  197.